package com.qingzhuge.member.dto.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.qingzhuge.common.enums.ESexType;
import com.qingzhuge.dto.response.BaseResponsePkLongDto;
import com.qingzhuge.member.entity.SysMemberAvatar;
import com.qingzhuge.member.entity.SysMemberThirdPartyAuth;
import com.qingzhuge.member.entity.SysMemberVerification;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;


/**
 * @author : zero.xiao
 * @description :
 * @date :2019-05-14 09:20
 * @modified :
 */
@ApiModel("用户信息")
@EqualsAndHashCode(callSuper = true)
@Data
public class SysMemberDto extends BaseResponsePkLongDto {
    @ApiModelProperty("用户名")
    private String username;
    @ApiModelProperty("昵称")
    private String nickname;
    @ApiModelProperty("邮箱")
    private String email;
    @ApiModelProperty("手机号")
    private String mobile;
    @ApiModelProperty("电话号码")
    private String phone;
    @ApiModelProperty("性别")
    private ESexType sex;
    @ApiModelProperty("地址")
    private String address;
    @ApiModelProperty("头像")
    private SysMemberAvatar avatar;
    @ApiModelProperty("默认头像")
    private String avatarUrl;
    @ApiModelProperty("第三方应用")
    private List<SysMemberThirdPartyAuth> oauth;
    @JSONField(serialize = false)
    private SysMemberVerification auth;
    @JSONField(serialize = false)
    private SysMemberThirdPartyAuth loginOauth;

    public SysMemberDto() {
    }

    public SysMemberDto(Integer code, String message) {
        super(code, message);
    }

    @ApiModelProperty("实人认证")
    public SysMemberAuthDto getVerify(){
        if (null != auth && auth.getStatus()){
            return doBackward(auth, SysMemberAuthDto.class);
        }
        return null;
    }
}
